#ifndef SNAKE0_H
#define SNAKE0_H

#include <QMainWindow>

namespace Ui {
class Snake0;
}

class Snake0 : public QMainWindow
{
    Q_OBJECT

public:
    explicit Snake0(QWidget *parent = 0);
    ~Snake0();
    void paintEvent(QPaintEvent *event);
    void initSnake();
    QRect CreateRect();
    void IsEat();
    void IsHit();
    void keyPressEvent(QKeyEvent *event);
private slots:
    void Snake_update();

private:
    Ui::Snake0 *ui;
    QVector<QRect> vSnakeRect;
    QRect vSnakeHead;
    QTimer *timer;//定时器
    int Direction;//蛇的移动方向
    bool Run;//是否开始
    bool Over;//是否结束
    QString sDisplay;//开始结束提示
    QRect food;
    int nScore;
    int speed;//移动速度
    QString scorelabel;//显示得分两个字
};

#endif // SNAKE0_H
